package src.main.java.org.oop.interfaceDemo2;

import java.sql.SQLOutput;
import java.util.ArrayList;

public class StudentOperatorImpl1 implements StudentOperator{

    @Override
    public void printAllInfo(ArrayList<Student> students) {
        System.out.println("--------全班全部信息如下--------------");
        for (int i = 0; i < students.size(); i++) {
            Student student = students.get(i);
            System.out.println("姓名："+student.getName());
            System.out.println("性别："+student.getSex());
            System.out.println("分数："+student.getScore());
            System.out.println("-----------");
        }
        System.out.println("------------------");
    }

    @Override
    public void printAvgScore(ArrayList<Student> students) {
        double allScore = 0.0;
        for (int i = 0; i < students.size(); i++) {
            Student student = students.get(i);
            allScore += student.getScore();
        }
        System.out.println("平均分:"+(allScore)/students.size());
    }
}
